package com.frank.subject.infra.basic.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.frank.subject.infra.basic.entity.SubjectInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author Frank Zou
 * @version v0.0.1
 * @date 2024/3/5
 * @description
 */
@Mapper
public interface SubjectInfoMapper extends BaseMapper<SubjectInfo> {


    /**
     * Query page
     *
     * @param page        page
     * @param subjectInfo subject information
     * @param labelId     label id
     * @param categoryId  category id
     * @return page result
     */
    Page<SubjectInfo> queryPage(Page<SubjectInfo> page, @Param("subjectInfo") SubjectInfo subjectInfo, @Param("labelId") Long labelId, @Param("categoryId") Long categoryId);

    /**
     * 根据 CategoryId，LabelId，SubjectId，以及 Cursor 查询 Subject Info
     *
     * @param subjectId  题目ID
     * @param categoryId 分类ID
     * @param labelId    标签ID
     * @param cursor     游标
     * @return 题目ID
     */
    Long querySubjectIdByCursor(@Param("subjectId") Long subjectId, @Param("categoryId") Long categoryId, @Param("labelId") Long labelId, @Param("cursor") int cursor);
}